#include "stdafx.h"
#include "refptr.h"




#include <memory>


static std::auto_ptr<DeleteHandler> s_deleteHandler(0);




Referenced::Referenced()
{
   _refCount=0;
}

Referenced::Referenced(const Referenced&)
{
    _refCount=0;
}

Referenced::~Referenced()
{
    if (_refCount>0)
    {

    }

}



/*
void Referenced::ref() const
{ 
    if (_refMutex)
    {
        OpenThreads::ScopedLock<OpenThreads::Mutex> lock(*_refMutex); 
        ++_refCount;
    }
    else
    {
        ++_refCount;
    }

}

void Referenced::unref() const
{
    bool needDelete = false;
    if (_refMutex)
    {
        OpenThreads::ScopedLock<OpenThreads::Mutex> lock(*_refMutex); 
        --_refCount;
        needDelete = _refCount<=0;
    }
    else
    {
        --_refCount;
        needDelete = _refCount<=0;
    }
    
    if (needDelete)
    {
        if (getDeleteHandler()) getDeleteHandler()->requestDelete(this);
        else delete this;
    }
}
*/
void Referenced::unref_nodelete() const
{
    
    {
        --_refCount;
    }
}
        

; // 

    